package com.baize.minespace.utils;

import com.baize.minespace.comment.MessageEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.ibatis.jdbc.Null;


@AllArgsConstructor
@NoArgsConstructor
@ToString
@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;
    public static Result<Null> success(){
        return new Result<>(200, MessageEnum.SUCCESS_MESSAGE.getVal(), null);
    }
    public static <T> Result<T> success(T data){
        return new Result<T>(200, MessageEnum.SUCCESS_MESSAGE.getVal(), data);
    }
    public static <T> Result<T> fail(T data){
        return new Result<T>(200, MessageEnum.FAIL_MESSAGE.getVal(), data);
    }
}
